package perceptronvocales.GUI;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import perceptronvocales.Model.Const;

/**
 *
 * @author PRETXEL-H
 */
public class Ayuda extends JFrame {

    /** 
     * Crea un formulario de Ayuda
     */  
    String a = "LetrasImagenes\\a.jpg";
    String b = "LetrasImagenes\\b.jpg";
    String c = "LetrasImagenes\\c.jpg";
    String d = "LetrasImagenes\\d.jpg";
    String e = "LetrasImagenes\\e.jpg";
    String f = "LetrasImagenes\\f.jpg";
    String g = "LetrasImagenes\\g.jpg";
    String h = "LetrasImagenes\\h.jpg";
    String i = "LetrasImagenes\\i.jpg";
    String j = "LetrasImagenes\\j.jpg";
    String k = "LetrasImagenes\\k.jpg";
    String l = "LetrasImagenes\\l.jpg";
    String m = "LetrasImagenes\\m.jpg";
    String n = "LetrasImagenes\\n.jpg";
    String o = "LetrasImagenes\\o.jpg";
    String p = "LetrasImagenes\\p.jpg";
    String q = "LetrasImagenes\\q.jpg";
    String r = "LetrasImagenes\\r.jpg";
    String s = "LetrasImagenes\\s.jpg";
    String t = "LetrasImagenes\\t.jpg";
    String u = "LetrasImagenes\\u.jpg";
    String v = "LetrasImagenes\\v.jpg";
    String w = "LetrasImagenes\\w.jpg";
    String x = "LetrasImagenes\\x.jpg";
    String y = "LetrasImagenes\\y.jpg";
    String z = "LetrasImagenes\\z.jpg";
    
    
    Icon ico[] = new ImageIcon[26];
    short index = 0;
    
    public Ayuda() {
        initComponents();
        ico[0] = new ImageIcon(a);
        ico[1] = new ImageIcon(b);
        ico[2] = new ImageIcon(c);
        ico[3] = new ImageIcon(d);
        ico[4] = new ImageIcon(e);
        ico[5] = new ImageIcon(f);
        ico[6] = new ImageIcon(g);
        ico[7] = new ImageIcon(h);
        ico[8] = new ImageIcon(i);
        ico[9] = new ImageIcon(j);
        ico[10] = new ImageIcon(k);
        ico[11] = new ImageIcon(l);
        ico[12] = new ImageIcon(m);
        ico[13] = new ImageIcon(n);
        ico[14] = new ImageIcon(o);
        ico[15] = new ImageIcon(p);
        ico[16] = new ImageIcon(q);
        ico[17] = new ImageIcon(r);
        ico[18] = new ImageIcon(s);
        ico[19] = new ImageIcon(t);
        ico[20] = new ImageIcon(u);
        ico[21] = new ImageIcon(v);
        ico[22] = new ImageIcon(w);
        ico[23] = new ImageIcon(x);
        ico[24] = new ImageIcon(y);
        ico[25] = new ImageIcon(z);
        
        imaIcon.setIcon(ico[index]);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        imaIcon = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setTitle("Ayuda");
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Ayuda")));

        jScrollPane1.setName("sd"); // NOI18N

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setText("Las siguientes letras de avecedario estan definidas en el programa, para que una red neuronal tipo perceptrón aprenda y trate de predecir la letra  en caso de que algún pixel falte.\n\nTambién se Implemento un algoritmo de auto aprendizaje ya que en cada entrenamiento la red halla una solución de muchas por lo tanto se realizo un conjunto de pruebas para que las evaluará.\nSe entrena 10 veces seguidas y cada uno se evalua al conjunto de pruebas posteriormente se obtiene una calificación dependiendo de los aciertos obtenidos, los aciertos se calculan comparando la salida esperada con la salida que se obtiene.\n\nPor lo tanto en cada uno de las 10 soluciones se obtiene una calificación y si supera la calificación del solución que esta fija, se guardan en un archivo(properties) y te marcan como valores fijos.");
        jTextArea1.setWrapStyleWord(true);
        jTextArea1.setName("s"); // NOI18N
        jScrollPane1.setViewportView(jTextArea1);

        jButton1.setText(">");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("<");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(260, 260, 260)
                                .addComponent(jButton2)
                                .addGap(40, 40, 40)
                                .addComponent(jButton1))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(145, 145, 145)
                                .addComponent(imaIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(imaIcon, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton2)
                            .addComponent(jButton1))
                        .addGap(21, 21, 21))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 675, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 10, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel1.getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        
        if(index<(Const.TotalAbecedario-1)){
            index++;
            imaIcon.setIcon(ico[index]);
        }
        else{
            index = 0;
            imaIcon.setIcon(ico[index]);
        }
        
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        
        if (index <= 0){
            index = 25;
            imaIcon.setIcon(ico[index]);
        }else{
            index--;
            imaIcon.setIcon(ico[index]);
        }
        
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void start() {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Ayuda.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Ayuda().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel imaIcon;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
}
